<?php
namespace Tug\Service;

use Tug\Dao\DetailDao;
use Plume\Core\Service;

class DetailService extends Service
{	
	public function __construct($app) {
        parent::__construct($app, new DetailDao($app));
    }
	

    public function setAnalysisData($data=array()){
        LogUtils::myLog('error.log', "接收到的数据：".json_encode($data));
        $conf=include BASE_PATH."/config/application.config.php";
        $url = $conf['analysis_url'];
        foreach($data as $item_data){
            $result = HttpUtils::http_post($url,$item_data);
            $json = json_decode($result['content'],true);
            if($json['code']!=0)
            {
                LogUtils::myLog('error.log', "埋入数据失败：".json_encode($json));
                return $result['content'];
            }
        }
        return json_encode(array("code"=>0,"msg"=>"success"));
    }
    public function draw($num,$proportion,$left,$right,$peoples){
          $wx_count = count($peoples);
       $number = rand(0,($wx_count-1));
       $open_id = $peoples[$number]->openid;
       $wx_image = $peoples[$number]->headimgurl;
       $wx_name = $peoples[$number]->nickname;
    }
}